<template>
  <div>
    <!-- 头部tab -->
    <!-- <div class="top_tab">
      <div class="left" @click="back()">
        <img  src="../assets/order_center/shangs.png">
      </div>
      <span>个人信息认证</span>
      <div class="right">
      </div>
    </div> -->
    <div class="title">
      <span>根据相关监管部门要求，个人必须信息认证后才能继续使用本平台，请完善信息：</span>
    </div>
		<div class="ts">
			<div class="bar">
				<div class="red">
					<span>手机号校验</span>
				</div>
				<div class="xian"></div>
				<div class="hui">
					<span>相关照片</span>
				</div>
			</div>
		</div>
		<div class="boxs">
			<div class="phone">
				<div class="tst">
					<span>+86</span>
					<input type="text" v-model="phone" placeholder="请输入手机号码">
				</div>
			</div>
			<div class="yz">
				<input type="text" placeholder="验证码" v-model="num">
				<yd-sendcode slot="right" 
							 v-model="start1" 
							 @click.native="send" 
							 type="danger">
				</yd-sendcode>
			</div> 
		</div>
		<div class="btn">
			<button class="next" @click="phone_approveClick()">下一步</button>
		</div>
	</div>
</template>

<script>
export default {
  name: "personal",
  data() {
    return {
      index: 0,
      isshow: false,
      start1: false,
      phone: "", //手机号
      code: "", //返回的验证码
      num: "" //验证码
    };
  },
  methods: {
    back: function() {
      this.$router.go(-1);
	},
	//下一步校验验证码
    phone_approveClick: function() {
       if(!this.phone){
			this.$dialog.toast({mes:'请输入手机号码'});
			return
		}
      if (this.num == this.code && this.num !== '') {
        this.$router.push("phone_approve");
	  }
	  else {
		this.$dialog.toast({
          mes: "请输入正确的验证码！",
          timeout: 2000
        });
	  }
    },
    //获取验证码
    send() {
      if(!this.phone){
			this.$dialog.toast({mes:'请输入手机号码'});
			return
		}
      let self = this;
      let reg_str = /^1\d{10}$/;
      if (!reg_str.test(this.phone)) {
        this.$dialog.notify({
          mes: "请输入正确手机号码！",
          timeout: 3000
        });
        return;
      }
      this.$dialog.loading.open("发送中...");
      let url = "/api/login/send";
      self.httpPost(url, { phone: this.phone, type: 2 }, function(res) {
        if (res.code == 200) {
          setTimeout(() => {
			self.code = res.data;
            self.start1 = true;
            self.$dialog.loading.close();
            self.$dialog.toast({
              mes: res.msg,
              icon: "success",
              timeout: 1500
            });
          }, 1000);
        } else {
          self.$dialog.loading.close();
          self.$dialog.toast({
            mes: res.msg,
            icon: "error",
            timeout: 1500
          });
        }
      });
    }
  },
  created() {
    document.title = '个人信息认证'
  },
};
</script>


<style scoped>
.top_tab {
  width: 100%;
  padding: 0.2rem 0.3rem;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0.01rem 0.01rem 0.06rem #ddd;
}
.top_tab span {
  color: #333;
  font-size: 0.36rem;
}
.top_tab .right {
  width: 1rem;
  display: flex;
  justify-content: space-between;
}
.top_tab img {
  width: 0.43rem;
}
.title {
  width: 100%;
  height: 1.5rem;
  padding: 0.3rem 0.3rem;
  display: flex;
  align-items: center;
  background: #bababa;
}
.title span {
  font-size: 0.3rem;
  color: #fff;
}
.ts {
  width: 100%;
  height: 1rem;
  display: flex;
  justify-content: center;
  background: #fff;
  border-bottom: 1px solid #cecece;
}
.ts .bar {
  width: 4.02rem;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ts .bar .red span {
  color: #e63f3f;
  font-size: 0.32rem;
}
.ts .bar .xian {
  width: 0.5rem;
  height: 0.05rem;
  background: #999;
}
.ts .bar .hui span {
  color: #999;
  font-size: 0.32rem;
}
.boxs {
  width: 100%;
  background: #fff;
  padding: 0.3rem 0.3rem;
}
.boxs .phone {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boxs .phone .tst {
  width: 100%;
  height: 0.9rem;
  border-radius: 5px;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.boxs .phone .tst input {
  width: 85%;
  height: .9rem;
  background: #f2f2f2;
  border: none;
}
.boxs .phone .tst span {
  color: #333;
  font-size: 0.32rem;
  line-height: 0.9rem;
  margin-left: 0.2rem;
}
.boxs .yz {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.3rem;
}
.boxs .yz input {
  border: none;
  width: 62%;
  height: 0.9rem;
  border-radius: 5px;
  background: #f2f2f2;
  text-indent: .25rem;
}
/* .boxs .yz button {
  border: none;
  background: #bababa;
  width: 35%;
  height: 0.9rem;
  border-radius: 5px;
  color: #fff;
  font-size: 0.32rem;
} */
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #999;
  font-size: 0.3rem;
}
input:-moz-placeholder,
textarea:-moz-placeholder {
  color: #999;
  font-size: 0.3rem;
}
input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #999;
  font-size: 0.3rem;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #999;
  font-size: 0.3rem;
}

.boxs .yz input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  font-size: 0.32rem;
  color: #333;
  padding-left: 0.2rem;
}
.boxs .yz input:-moz-placeholder,
textarea:-moz-placeholder {
  font-size: 0.32rem;
  color: #333;
  padding-left: 0.2rem;
}
.boxs .yz input::-moz-placeholder,
textarea::-moz-placeholder {
  font-size: 0.32rem;
  color: #333;
  padding-left: 0.2rem;
}
.boxs .yz input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  font-size: 0.32rem;
  color: #333;
  padding-left: 0.2rem;
}
.btn {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0.4rem;
}
.btn .next {
  width: 90%;
  height: 0.9rem;
  background: #e63f3f;
  border: none;
  border-radius: 10px;
  font-size: 0.32rem;
  color: #fff;
}
</style>



